/*
 * File.java Copyright 2004 Paul Mukherjee
 */
package org.nanhill.support.hibernate.search.demo.filesearch;

import java.util.Date;

/**
 * @author pmu
 * @version $Revision: 1.1 $
 *
 * Representation of a File in an archive volume.
 */
public class File {
  /**
   * Unique identifier for the file, corresponding to the primary key in the database.
   */
  private Integer id;
  
  /**
   * The name of the file. 
   */
  private String name;
  
  /**
   * The size of the file in bytes.
   */
  private Integer size;
  
  /**
   * The last modification date for the file.
   */
  private Date lastModified;
  
  /**
   * The backup volume containing this file.
   */
  private Volume volume;
  
  /**
   * The name of the backup volume.
   */
  private String volumeName;
  
  /**
   * Creates an instance of this class.
   */
  public File(){
  }
  
  /**
   * @return Returns the id.
   */
  public Integer getId() {
    return id;
  }
  
  /**
   * @param id The id to set.
   */
  public void setId(Integer id) {
    this.id = id;
  }
  
  /**
   * @return Returns the lastModified.
   */
  public Date getLastModified() {
    return lastModified;
  }
  
  /**
   * @param lastModified The lastModified to set.
   */
  public void setLastModified(Date lastModified) {
    this.lastModified = lastModified;
  }
  
  /**
   * @return Returns the name.
   */
  public String getName() {
    return name;
  }
  
  /**
   * @param name The name to set.
   */
  public void setName(String name) {
    this.name = name;
  }
  
  /**
   * @return Returns the size.
   */
  public Integer getSize() {
    return size;
  }
  
  /**
   * @param size The size to set.
   */
  public void setSize(Integer size) {
    this.size = size;
  }
  
  /**
   * @return Returns the volume.
   */
  public Volume getVolume() {
    return volume;
  }
  
  /**
   * @param volume The volume to set.
   */
  public void setVolume(Volume volume) {
    this.volume = volume;
  }
  
  /**
   * @return Returns the volumeName.
   */
  public String getVolumeName() {
    if (volume == null){
      return volumeName;
    } else {
      return volume.getName();
    }
  }
  
  /**
   * @param volumeName The volumeName to set.
   */
  public void setVolumeName(String volumeName) {
    this.volumeName = volumeName;
  }
}
